<template>
  <div class="userinfor_con">
    <div class="userinfor">
      <div class="headp">
        <input type="file">
        <h4>头像</h4>
        <div class="headpor">
          <img src="../assets/6.jpg">
          <i class="iconfont icon-fanhui1"></i>
        </div>
      </div>
      <div class="uname">
        <div class="uname_con">
          <h4>用户名</h4>
          <div class="unamer">
            <p>{{username}}</p>
            <i class="iconfont icon-fanhui1"></i>
          </div>
        </div>
      </div>
      <div class="inforadd">
        <h4>收货地址</h4>
        <i class="iconfont icon-fanhui1"></i>
      </div>

      <div class="bind">
        <p>账号绑定</p>
      </div>
      <div class="phonebind">
        <div class="pl">
          <i class="iconfont icon-shouji"></i>
          <span>手机</span>
        </div>
        <div class="pr">
          <i class="iconfont icon-fanhui1"></i>
        </div>
      </div>
      <div class="safe">
        <p>安全设置</p>
      </div>
      <div class="phonebind"
           @click="xiugaimima()">
        <div class="pl">
          <span>登录密码</span>
        </div>
        <div class="pr">
          <p>修改</p>
          <i class="iconfont icon-fanhui1"></i>
        </div>
      </div>
    </div>
    <div class="exitl">
      <button class="exit"
              @click="quitAction">退出登录</button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'UserInfor',
  data: function () {
    return {
      username: localStorage.getItem('username')
    }
  },
  methods: {
    quitAction () {
      localStorage.removeItem('code');
      localStorage.removeItem('username');
      localStorage.removeItem('uid');
      this.$router.push({ name: 'Mine' });
    },
    xiugaimima () {
      this.$router.push({ name: 'Update' })
    }
  },
}
</script>

<style lang="less">
body {
  background-color: #f5f5f5;
}

.userinfor {
  background-color: white;
  .headp,
  .uname_con,
  .inforadd,
  .phonebind {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-top: 10px;
    border-top: 1px solid #ddd;

    input {
      display: block;
      position: absolute;
      opacity: 0;
      width: 100%;
      height: 73px;
    }
    h4 {
      font-size: 16px;
      color: #333;
      font-weight: 500;
    }
    .headpor,
    .unamer {
      display: flex;
      align-items: center;
      img {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        margin-right: 10px;
      }
      i {
        font-size: 15px;
        color: #ccc;
      }
      p {
        font-size: 16px;
        color: #999;
      }
    }
  }
  .bind,
  .safe {
    font-size: 12px;
    color: #666;
    padding: 10px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
  }
  .phonebind {
    margin-top: 0;
    .pl {
      i {
        font-size: 18px;
        color: white;
        background-color: #3190e8;
        margin-right: 10px;
      }
      span {
        font-size: 16px;
        color: #333;
      }
    }
    .pr {
      display: flex;
      align-items: center;
      p {
        font-size: 16px;
        color: #333;
      }
    }
  }
}
.exitl {
  width: 100%;
  background-color: #f5f5f5;
  margin-top: 30px;
  margin: 30px 10px;
  .exit {
    width: 96%;
    font-size: 16px;
    color: #fff;
    text-align: center;
    padding: 10px;
    border: none;
    border-radius: 5px;
    background-color: #d8584a;
  }
}
</style>